package com.fwtai.web;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 知识访问数据库
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2021-07-23 11:23:29
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class KnowledgeDao{

    @Resource
    private DaoHandle dao;

    public int add(final PageFormData pageFormData){
        return dao.execute("knowledge.add",pageFormData);
    }

    public String queryExistById(final String kid){
        return dao.queryForString("knowledge.queryExistById",kid);
    }

    public int edit(final PageFormData pageFormData){
        return dao.execute("knowledge.edit",pageFormData);
    }

    public HashMap<String, Object> queryById(final String kid){
        return dao.queryForHashMap("knowledge.queryById",kid);
    }

    public int delById(final PageFormData formData){
        return dao.execute("knowledge.delById",formData);
    }

    public int delByKeys(final PageFormData formData){
        return dao.execute("knowledge.delByKeys",formData);
    }

    public HashMap<String,Object> listData(final PageFormData pageFormData){
        return dao.queryForPage(pageFormData,"knowledge.listData","knowledge.listTotal");
    }

    public List<Map<String, Object>> getDomainList(){
        return dao.queryForListMap("knowledge.getDomainList");
    }

    public String getCoverPath(final String kid){
        return dao.queryForString("knowledge.getCoverPath",kid);
    }

    public String getPreInfo(final String kid){
        return dao.queryForString("knowledge.getPreInfo",kid);
    }
}